package cn.chengyi.linpq.springboot2024.web;

import cn.chengyi.linpq.springboot2024.dao.StudentMapper;
import cn.chengyi.linpq.springboot2024.domain.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class StudentController {

    @Autowired
    StudentMapper studentMapper;

    @ResponseBody
    @RequestMapping("/student")
    public List<Student> html2() {

        Student student = new Student();
        student.setAge(19);
        student.setName("zhangsan"+Math.random());
        studentMapper.insert(student);


        return studentMapper.selectAll();
    }



}
